Skip to content

feat: add Features and About links to navbar#607

Open
weiwei-gitch wants to merge 1 commit into
GitMetricsLab:mainfrom
weiwei-gitch:feat/add-navbar-links
Open

feat: add Features and About links to navbar#607
weiwei-gitch wants to merge 1 commit into
GitMetricsLab:mainfrom
weiwei-gitch:feat/add-navbar-links

Conversation

@weiwei-gitch
Copy link
Copy Markdown

@weiwei-gitch weiwei-gitch commented May 29, 2026

Related Issue

Description

Added "Features" and "About" navigation links to the navbar as requested in the issue.

Added a Features link that smoothly scrolls to the #features section on the homepage. If the user is on a different page, it navigates to the homepage first and then scrolls to the section.
Added an About link that navigates to the existing /about page.
Both links are added to the desktop and mobile menus, following the existing UI theme and responsive design.
Fixed the Home NavLink active state by adding the end prop to prevent it from always appearing active.

How Has This Been Tested?

  • Verified "Features" smooth scrolls to the features section when clicked from the homepage.
  • Verified "Features" navigates to homepage and scrolls correctly when clicked from other pages.
  • Verified "About" navigates to /about page correctly.
  • Tested both desktop navbar and mobile hamburger menu.
  • Verified active link highlighting works correctly for all nav items.

Screenshots

image

Type of Change

  • New feature

Summary by CodeRabbit

  • New Features

    • Added smooth-scrolling "Features" navigation link that scrolls to the features section
    • Mobile menu items now automatically close the menu when clicked
  • Style

    • Updated navbar logo from image to "GitHub Tracker" text label

Review Change Stack

@netlify
Copy link
Copy Markdown

netlify Bot commented May 29, 2026

Deploy Preview for github-spy ready!

Name Link
🔨 Latest commit c2159b1
🔍 Latest deploy log https://app.netlify.com/projects/github-spy/deploys/6a1955679bf0770008f942b5
😎 Deploy Preview https://deploy-preview-607--github-spy.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 29, 2026

📝 Walkthrough

Walkthrough

The PR adds smooth-scrolling navigation to a Features section in the Navbar. It introduces routing-aware behavior, replaces the logo with text, adds a clickable Features item to both desktop and mobile menus, and ensures all mobile links close the menu on interaction.

Changes

Features Section Navigation

Layer / File(s) Summary
Routing setup and feature navigation handler
src/components/Navbar.tsx
React Router imports (useNavigate, useLocation) enable programmatic navigation and route detection. The featureLinkStyles class and handleFeaturesClick handler implement smooth-scrolling to #features when on /, or navigation to /#features followed by scroll on other routes.
Desktop navbar with Features link
src/components/Navbar.tsx
Logo image element is replaced with a "GitHub Tracker" text label. A new clickable "Features" nav item is added to the desktop menu, wired to trigger handleFeaturesClick.
Mobile menu with Features and menu-close wiring
src/components/Navbar.tsx
All mobile menu links (Home, Features, About, Tracker, Contributors, Login) now call closeMenu on click. The mobile "Features" item is implemented as a clickable element that uses the same handleFeaturesClick handler as desktop.

Sequence Diagram(s)

No sequence diagram generated. The changes represent straightforward UI event handling (onClick → scroll or navigate) without multi-component orchestration that would benefit from visualization.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • GitMetricsLab/github_tracker#237: Modifies src/components/Navbar.tsx to update the "Features" nav behavior with hash-based smooth scrolling and route-aware handling.
  • GitMetricsLab/github_tracker#330: Modifies src/components/Navbar.tsx navigation and mobile menu implementation with overlapping link markup and handler changes.
  • GitMetricsLab/github_tracker#282: Modifies src/components/Navbar.tsx mobile and desktop navigation className and onClick behavior in the same navbar markup sections.

Suggested labels

level:intermediate, quality:clean

Poem

🐰 A Features link so smooth and swift,
On mobile menus—what a gift!
The navbar jumps to sections bright,
Smooth scrolling makes the nav just right.
From desktop clicks to phone-screen taps,
Now users find what's on the map! 🚀

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The PR title clearly summarizes the main change: adding Features and About navigation links to the navbar.
Description check ✅ Passed The PR description follows the template structure with all required sections completed, including Related Issue, Description, Testing, and Type of Change.
Linked Issues check ✅ Passed The code changes successfully implement all requirements from issue #579: Features and About links added to navbar with smooth scrolling and responsive design support.
Out of Scope Changes check ✅ Passed All changes in Navbar.tsx are directly aligned with issue #579 objectives; the Home NavLink active state fix is a reasonable related improvement.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉 Thank you @weiwei-gitch for your contribution. Please make sure your PR follows https://github.com/GitMetricsLab/github_tracker/blob/main/CONTRIBUTING.md#-pull-request-guidelines

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/components/Navbar.tsx`:
- Around line 70-72: Replace the non-semantic, non-keyboard-operable <span>
elements used for interactive navigation with proper interactive elements (e.g.,
<button> or <a>) so they are keyboard-accessible and provide correct semantics;
specifically update the element using className featureLinkStyles and
onClick={handleFeaturesClick} (and the second similar span at lines ~143-145) to
use a button or anchor, preserve existing event handlers (handleFeaturesClick),
add appropriate ARIA attributes and keyboard handlers if needed, and ensure
styling still applies via featureLinkStyles so visual appearance is unchanged.
- Around line 38-42: The timeout-based scroll after calling
navigate("/#features") is race-prone; instead remove the setTimeout and move the
scroll logic to run when the route/hash actually changes (for example, in the
component that renders the "features" section or a top-level effect that watches
location.hash). Detect the hash (location.hash or listen to "hashchange") and
when it equals "`#features`" call document.getElementById("features") and
section.scrollIntoView({ behavior: "smooth" }); (or run this on mount via
useEffect in the Features-containing component) rather than relying on
setTimeout in the Navbar navigate handler.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 227f5825-ed33-46e0-bc48-3404a542d602

📥 Commits

Reviewing files that changed from the base of the PR and between 4ae0ef6 and c2159b1.

📒 Files selected for processing (1)
  • src/components/Navbar.tsx

Comment thread src/components/Navbar.tsx
Comment on lines +38 to +42
navigate("/#features");
setTimeout(() => {
const section = document.getElementById("features");
if (section) section.scrollIntoView({ behavior: "smooth" });
}, 100);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Avoid timeout-based scroll sequencing after route change.

Line 39’s fixed setTimeout(100) is race-prone; slower renders can miss the target section and silently fail to scroll. Trigger scrolling from route/hash change instead of a time delay.

Suggested fix
-import { useState, useContext } from "react";
+import { useState, useContext, useEffect } from "react";
...
   const handleFeaturesClick = () => {
     closeMenu();
     if (location.pathname === "/") {
       const section = document.getElementById("features");
       if (section) {
         section.scrollIntoView({ behavior: "smooth" });
       }
     } else {
-      navigate("/#features");
-      setTimeout(() => {
-        const section = document.getElementById("features");
-        if (section) section.scrollIntoView({ behavior: "smooth" });
-      }, 100);
+      navigate("/#features");
     }
   };
+
+  useEffect(() => {
+    if (location.pathname === "/" && location.hash === "`#features`") {
+      const section = document.getElementById("features");
+      if (section) {
+        section.scrollIntoView({ behavior: "smooth" });
+      }
+    }
+  }, [location.pathname, location.hash]);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/Navbar.tsx` around lines 38 - 42, The timeout-based scroll
after calling navigate("/#features") is race-prone; instead remove the
setTimeout and move the scroll logic to run when the route/hash actually changes
(for example, in the component that renders the "features" section or a
top-level effect that watches location.hash). Detect the hash (location.hash or
listen to "hashchange") and when it equals "`#features`" call
document.getElementById("features") and section.scrollIntoView({ behavior:
"smooth" }); (or run this on mount via useEffect in the Features-containing
component) rather than relying on setTimeout in the Navbar navigate handler.

Comment thread src/components/Navbar.tsx
Comment on lines +70 to +72
<span className={featureLinkStyles} onClick={handleFeaturesClick}>
Features
</span>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Replace clickable <span> with semantic interactive controls.

Line 70 and Line 143 use clickable <span> elements, which are not keyboard-operable by default and miss expected navigation semantics. This is an accessibility blocker for keyboard users.

Suggested fix
-          <span className={featureLinkStyles} onClick={handleFeaturesClick}>
+          <button
+            type="button"
+            className={`${featureLinkStyles} focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500`}
+            onClick={handleFeaturesClick}
+          >
             Features
-          </span>
+          </button>
-            <span className={featureLinkStyles} onClick={handleFeaturesClick}>
+            <button
+              type="button"
+              className={`${featureLinkStyles} text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500`}
+              onClick={handleFeaturesClick}
+            >
               Features
-            </span>
+            </button>

Also applies to: 143-145

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/Navbar.tsx` around lines 70 - 72, Replace the non-semantic,
non-keyboard-operable <span> elements used for interactive navigation with
proper interactive elements (e.g., <button> or <a>) so they are
keyboard-accessible and provide correct semantics; specifically update the
element using className featureLinkStyles and onClick={handleFeaturesClick} (and
the second similar span at lines ~143-145) to use a button or anchor, preserve
existing event handlers (handleFeaturesClick), add appropriate ARIA attributes
and keyboard handlers if needed, and ensure styling still applies via
featureLinkStyles so visual appearance is unchanged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add “About” Section Navigation Link in Navbar

1 participant